package com.uzai.console.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.uzai.console.annotation.UserAccDetailInsert;
import com.uzai.console.dto.user.useraccdetail.UserAccDetailQuery;
import com.uzai.console.entity.UserAccDetail;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;

@Repository
public interface UserAccDetailMapper {
    int deleteById(@Param("id") Long id, @Param("merId") Long merId);

    @UserAccDetailInsert//增加注解，aop进行监控
    int insert(UserAccDetail record);

    UserAccDetail selectById(@Param("id") Long id, @Param("merId") Long merId);

    UserAccDetail selectByUserIdAndTypeAndOrderId(@Param("userId") Long userId, @Param("type") Integer type, @Param("orderId") String orderId);

    UserAccDetail selectByUserIdAndTypeAndOrderIdLike(@Param("userId") Long userId, @Param("type") Integer type, @Param("orderId") String orderId);

    UserAccDetail selectByUserIdAndTypeAndTradeno(@Param("userId") Long userId, @Param("type") Integer type, @Param("tradeno") String tradeno);

    int updateByIdSelective(UserAccDetail record);

    int updateByUserIdAndTypeAndTradeno(UserAccDetail record);

    /**
     * 分页查询
     * @param page
     * @param query
     * @return
     */
    ArrayList<UserAccDetail> findByList(Page<UserAccDetail> page, @Param("query") UserAccDetailQuery query);

    /**
     * 查询所有
     * @param query
     * @return
     */
    ArrayList<UserAccDetail> findByList(@Param("query") UserAccDetailQuery query);

    /**
     * 批量替换机器人信息
     * @param merId
     * @return
     */
    int batchUpdateDeviceInfo(@Param("oldDeviceUniqueId") Long oldDeviceUniqueId, @Param("newDeviceUniqueId") Long newDeviceUniqueId, @Param("merId") Long merId);


}